const Sequelize = require('sequelize');
module.exports.initModel = async sequelize => {
  // ##BEGIN## 代码已加密
  //暗号：哈希算法
  //暗号：哈希算法
  //暗号：哈希算法
  const Product = sequelize.define('product', {
    id: {
      type: Sequelize.INTEGER,
      autoIncrement: true,
      allowNull: false,
      primaryKey: true
    },
    title: {
        type: Sequelize.STRING,
        allowNull: false
    },
  });
  const User = sequelize.define('user', {
    id : {
      type: Sequelize.INTEGER,
      autoIncrement: true,
      allowNull: false,
      primaryKey: true
    },
    name: Sequelize.STRING,
  });

  User.hasMany(Product);
  await sequelize.sync({ force: true })
  // ##END##
  return { User, Product }
} 
